<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::header">
	<title>DangXia</title>
</head>
<body class="login-bg">
    <div class="login layui-anim layui-anim-up">
        <div class="message">当下公寓后台登录</div>
        <div id="darkbannerwrap"></div>
        <form id="loginForm" method="post" class="layui-form" action="/dangxia/login/isLogin">
            <input name="empLoginname" placeholder="用户名" value="admin"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input id="password" name="empPassword" value="admin" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit"/>
            <hr class="hr20">
        </form>
    </div>

    <script type="text/javascript" th:inline="none">

        //定义提交锁
        var formLock = true;

            layui.use('form', function(){
              var form = layui.form;
              // layer.msg('玩命卖萌中', function(){
              //   //关闭后的操作
              //   });
              //监听提交
              form.on('submit(login)', function(data){
                  //判断是否可以提交
                  if (!formLock){
                      return false;
                  }
                  //修改锁状态
                  formLock = false;
                    $("#loginForm").ajaxForm(function (data) {
                        if (data.code==0){
                            layer.msg(data.msg,{icon: 1});
                           window.location.href="/dangxia/login/toIndex";
                        }else {

                            layer.msg(data.msg,{icon: 5});
                            $("#password").val("");
                        }
                        //修改锁状态
                        formLock = true;
                    })
              });
            });
    </script>

</body>
</html>